<?php

namespace App\Supports\Payment\Methods;

use App\Supports\Payment\Contracts\PayChannel;

class Method
{
	/**
	 * @var PayChannel
	 */
	protected $channel;
	
	public function setChannel($channel)
	{
		$this->channel = $channel;
	}
	
	protected function getPaidCode($outTradeNumber)
	{
		// ['order' => '201...']
		return collect(explode('_', $outTradeNumber));
	}
	
	protected function getPaidTag($outTradeNumber)
	{
		$number = $this->getPaidCode($outTradeNumber);
		$number->pop();
		return $number->implode('_');
	}
	
	protected function getPaidNumber($outTradeNumber)
	{
		return $this->getPaidCode($outTradeNumber)->last();
	}
}
